package net.carinae.dev.seduku.web;

import net.carinae.dev.seduku.web.pages.Play;

import org.apache.wicket.protocol.http.HttpSessionStore;
import org.apache.wicket.protocol.http.WebApplication;
import org.apache.wicket.request.target.coding.HybridUrlCodingStrategy;
import org.apache.wicket.session.ISessionStore;
import org.apache.wicket.spring.injection.annot.SpringComponentInjector;


/**
 * Seduku wicket application.
 * 
 * @author Carlos Vara
 */
public class SedukuApp extends WebApplication {
	
	@Override
	protected void init() {
		super.init();
		
        // @see http://cwiki.apache.org/WICKET/spring.html
        addComponentInstantiationListener(new SpringComponentInjector(this));
		
		// Remove thread monitoring from resource watcher
		// @see http://www.danwalmsley.com/2009/04/08/apache-wicket-on-google-app-engine-for-java/
		this.getResourceSettings().setResourcePollFrequency(null);
		
		mount(new HybridUrlCodingStrategy("/play", Play.class));
	}
	
	
	@Override
	protected ISessionStore newSessionStore() {	
		return new HttpSessionStore(this);
//		return new SecondLevelCacheSessionStore(this, new InMemoryPageStore());
//		return new SecondLevelCacheSessionStore(this, new MemcachePageStore());
	}
	

	@Override
	public Class<Play> getHomePage() {
		return Play.class;
	}

}
